<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>汽车出租管理系统</title>
	<meta name="renderer" content="webkit">
	<meta name="format-detection" content="telephone=no">
	<link rel="icon" href="favicon.ico">
	<link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="loginBody">
	<form class="layui-form">
		<div class="login_face"><img src="resources/images/face.jpg" class="userAvatar" alt="汽车管理系统"></div>
		<div class="layui-form-item input-item">
			<label for="userName">用户名</label>
			<input type="text" style="padding-left:65px;" autocomplete="off" id="userName" name="userName" class="layui-input" lay-verify="required" lay-text="请输入用户名">
		</div>
		<div class="layui-form-item input-item">
			<label for="password">密&emsp;码</label>
			<input type="password" style="padding-left:65px;" autocomplete="off" id="password" name="password" class="layui-input" lay-verify="required" lay-text="请输入密码">
		</div>
		<div class="layui-form-item input-item" id="imgCode">
			<label for="checkCode">验证码</label>
			<input type="text" style="padding-left:65px;" id="checkCode" name="checkCode" placeholder="请输入验证码" autocomplete="off" id="code" class="layui-input" lay-text="请输入验证码">
			<img id="codeImg" src="common/checkCode.do" style="width: 100px;height: 35px" alt="验证码">
		</div>
		<div class="layui-form-item">
			<button class="layui-btn layui-block" lay-filter="login" lay-submit>登录</button>
		</div>
		<div class="layui-form-item layui-row" style="text-align: right">
			<a id="qrCode" href="#" style="color:#d2d2d2;">扫码登录>></a>
		</div>
	</form>
	<script type="text/javascript" src="resources/layui/layui.js"></script>
	<script type="text/javascript" src="resources/js/cache.js"></script>
	<script type="text/javascript">
		layui.use(['jquery','form','layer'],function(){
			var $ = layui.jquery;
			var form = layui.form;
			var layer = layui.layer;
			
			// 验证码添加点击事件
			$("#codeImg").click(function(){
				$(this).attr("src","common/checkCode.do?"+new Date());
			});
			
			// 点击后显示二维码
			$("#qrCode").click(function(){
				layer.open({
					type:1,
					area:['205px','245px'],
					shade :[0.8, '#393D49'],
					shadeClose:true,
					title:"扫一扫",
					content:"<div style='margin:auto;'><img style='margin:auto' src='common/qrCode.do'  alt='二维码'/></div>"
				});
			});
			
			// 登录的事件
			form.on("submit(login)",function(d){
				console.log(d);
				$.post("sys/user/login.do",d.field,function(rs){
					if(rs.code !== 200){
						layer.msg(rs.msg);
						return false;
					}
					// 跳转到  
					location.href="page/index.do"
				});
				return false;
			})
			
		});
	</script>
</body>
</html>